package com.zhou.utils;

import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringToListUtils {

    public static List<String> result(String str){

        // 全角字符转半角字符
        char c[] = str.toCharArray();
        for (int i = 0; i < c.length; i++) {
            if (c[i] == '\u3000') {
                c[i] = ' ';
            } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') {
                c[i] = (char) (c[i] - 65248);
            }
        }
        String s = new String(c);

        // 将中文逗号转为英文逗号
        String s1 = s.replaceAll("，",",");

        if (s1!=null) {
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(s1);
            s1 = m.replaceAll("");
        }

        List<String> result = Arrays.asList(s1.split(","));

        return result;
    }
}
